<%-- 
    Document   : contact_company_all
    Created on : Jan 23, 2013, 2:31:03 AM
    Author     : owtee
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<script type="text/javascript" src="../js/contact_company.js"></script>

<div id="templatemo_main_wrapper">
    <div id="templatemo_main">
        <div id="content">             
            <div id="home" class="section">                                
                <table align="center" border="0">
                    <tr>
                        <td>
                            <form method="POST" action="ContactCompanyGetAll">                                                            
                                <table align="center" width="500px" border="0">
                                    <tr>
                                        <td colspan="4">${message.getMesDetail()}</td>
                                    </tr>
                                    <tr>
                                        <td style="text-align: right; width: 25%;">ชื่อบริษัท :</td>
                                        <td style="text-align: left; width: 25%">
                                            <input type="text" id="txtConComNameKey" name="txtConComNameKey" />
                                        </td>
                                        <td style="text-align: left; width: 25%">
                                            <input type="image" src="../images/search.gif" onmouseout="src='../images/search.gif'" onmouseover="src='../images/search_hover.gif'" name="submit" value="ค้นหา" />
                                        </td>
                                        <td style="text-align: left; width: 25%">&nbsp;</td>
                                    </tr>
                                    <tr>
                                        <td colspan="4">&nbsp;</td>
                                    </tr>
                                </table>
                            </form>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input type="button" value="เพิ่ม บริษัท" onclick="location.href='contact_company_add.jsp'"/>
                            <input type="button" value="กลับสู่เมนูย่อย" onclick="location.href='../view/sub_menu.jsp'"/>
                        </td>
                    </tr>
                    <c:if test="${conComLst.size() > 0}">
                        <tr>
                            <td>
                                <fieldset>
                                    <legend> :: Company All :: </legend>
                                        <table class="tbl_full" width="700px" align="center">
                                            <thead>
                                                <td width="10%">รหัสบริษัท</td>
                                                <td width="35%">ชื่อบริษัท</td>
                                                <td width="35%">ที่อยู่บริษัท</td>
                                                <td width="10%">แก้ไข</td>
                                                <td width="10%">ลบ</td>
                                            </thead>                                
                                            <c:forEach items="${conComLst}" var="conCom" varStatus="status">
                                                <tbody>
                                                    <td style="text-align: center">${conCom.getConComId()}</td>
                                                    <td style="text-align: left">${conCom.getConComName()}</td>
                                                    <td style="text-align: left">${conCom.getConComAddress()}</td>
                                                    <td style="text-align: center">
                                                        <input type="image" src="../images/edit.png" value="แก้ไข" onclick="location.href='ContactCompanyGetById?conComId=${conCom.getConComId()}'"/>
                                                    </td>
                                                    <td style="text-align: center">
                                                        <input type="image" src="../images/delete.png" value="ลบ" onclick="confirmDelete('${conCom.getConComId()}', '${conCom.getConComName()}')"/>
                                                    </td>
                                                </tbody>
                                            </c:forEach>                                    
                                        </table>
                                </fieldset>
                            </td>
                        </tr> 
                        <tr>
                            <td style="text-align: right">                                                                    
                                <c:if test="${pageNo != 0}">
                                    <a href="ContactCompanyGetAll?txtConComNameKey=${txtConComNameKey}&page_no=${pageNo - 1}"><<หน้าก่อนหน้า</a>&nbsp;
                                </c:if>
                                <c:forEach var="i" begin="0" end="${pageCount-1}">
                                    <c:choose>
                                        <c:when test="${i == pageNo}">
                                            ${i+1}&nbsp;
                                        </c:when>
                                        <c:otherwise>                                        
                                            <a href="ContactCompanyGetAll?txtConComNameKey=${txtConComNameKey}&page_no=${i}">${i+1}</a>&nbsp;
                                        </c:otherwise>
                                    </c:choose>                
                                </c:forEach>
                                <c:if test="${pageNo != (pageCount - 1)}">
                                    <a href="ContactCompanyGetAll?txtConComNameKey=${txtConComNameKey}&page_no=${pageNo + 1}">หน้าถัดไป>></a>
                                </c:if>  
                            </td>
                        </tr>
                    </c:if>
                </table>                
            </div>                         
        </div> 
    </div>
</div>
